package com.ck.ips.service.impl.program;

import com.ck.common.model.ScreenCanvasMapping;
import com.ck.ips.dao.program.ScreenCanvasMappingMapper;
import com.ck.ips.model.vo.program.ScreenCanvasMappingVO;
import com.ck.ips.service.program.ScreenCanvasMappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author linqiang
 * @version v1.0
 * @Description 分辨率与画布Service实现类
 * @date 2019-04-29 17:01
 */
@Service(value = "screenCanvasMappingService")
public class ScreenCanvasMappingServiceImpl implements ScreenCanvasMappingService {

    @Autowired
    private ScreenCanvasMappingMapper screenCanvasMappingMapper;

    /**
     * 根据分辨率查询画布
     *
     * @param screenWidth  屏幕分辨率宽
     * @param screenHeight 屏幕分辨率高
     * @return
     */
    @Override
    public ScreenCanvasMapping selectByScreen(Integer screenWidth, Integer screenHeight) {
        if (null == screenHeight || null == screenWidth) {
            return null;
        }
        return screenCanvasMappingMapper.selectByScreen(screenWidth, screenHeight);
    }

    /**
     * 获取分辨率画布映射关系列表
     *
     * @return List
     */
    @Override
    public List<ScreenCanvasMappingVO> getMappingForConfig() {
        return screenCanvasMappingMapper.getMappingForConfig();
    }
}
